<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>ting Manager</title>
    <link href="/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="/">Ting</a>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="/course">课程</a></li>
                <li><a href="/upload">上传文件</a></li>
                <li><a href="/user">用户管理</a></li>
                <li class="active"><a href="/comment">评论</a></li>
            </ul>
        </div>
    </div>
</nav>
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">待处理<span class="badge"><%= noHandleComments.length %></span></h3>
    </div>
    <div class="panel-body">
        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
            <% for(var i = 0, comment;comment = noHandleComments[i++];) { %>
            <div class="panel panel-default">
                <div class="panel-heading" role="tab" id="heading<%= i + 'no' %>">
                    <h4 class="panel-title">
                        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse<%= i + 'no' %>" aria-expanded="false"
                           aria-controls="collapse<%= i + 'no' %>">
                            <span style="font-weight: normal;margin-left: 50px">用户: <%= comment.userId %></span>
                            <span style="margin-left: 100px; font-weight: normal">时间: <%= comment.ctime.toLocaleString() %></span>
                        </a>
                    </h4>
                </div>
                <div id="collapse<%= i + 'no' %>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<%= i + 'no' %>">
                    <div class="panel-body">
                        <p><%= comment.content %></p>
                        <hr>
                        <p>
                        <form action="/comment" method="post">
                            <input type="hidden" value="<%= comment._id %>" name="commentId">
                            <input type="submit" class="btn btn-default" href="/comment" value="处理">
                        </form>
                        </p>
                    </div>
                </div>
            </div>
            <% } %>
        </div>
    </div>
</div>

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">已处理</h3>
    </div>
    <div class="panel-body">
        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
            <% for(var i = 0, comment;comment = handledComments[i++];) { %>
            <div class="panel panel-default">
                <div class="panel-heading" role="tab" id="heading<%= i + 'handled' %>">
                    <h4 class="panel-title">
                        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse<%= i + 'handled' %>" aria-expanded="false"
                           aria-controls="collapse<%= i + 'handled' %>">
                            <span style="font-weight: normal;margin-left: 50px">用户: <%= comment.userId %></span>
                            <span style="margin-left: 100px; font-weight: normal">时间: <%= comment.ctime.toLocaleString() %></span>
                        </a>
                    </h4>
                </div>
                <div id="collapse<%= i + 'handled' %>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<%= i + 'handled' %>">
                    <div class="panel-body">
                        <p><%= comment.content %></p>
                        <hr>
                        <p>
                            <span class="label label-success">已处理</span>
                            <span class="label label-info">处理时间:<%= comment.htime.toLocaleString() %></span>
                        </p>
                    </div>
                </div>
            </div>
            <% } %>
        </div>
    </div>
</div>
</body>
<script src="/js/jquery.js"></script>
<script src="/js/bootstrap.js"></script>
</html>